package com.example.designpatterns.creational.prototype;

/**
 * 客户端，使用原型模式
 *
 * @author scott
 */
public class Client {

    public static void main(String[] args) {
        // 创建原型对象
        ConcretePrototype prototype = new ConcretePrototype(1);

        // 克隆对象
        ConcretePrototype clone1 = prototype.clone();
        clone1.setId(2);

        ConcretePrototype clone2 = prototype.clone();
        clone2.setId(3);

        // 输出对象的id
        System.out.println("Prototype: " + prototype.getId());
        System.out.println("Clone 1: " + clone1.getId());
        System.out.println("Clone 2: " + clone2.getId());
    }

}
